#coding:utf-8
__author__ = 'hl'
from baseGridTable import BaseGridTable
import wx.grid
class TableWithCheckBoxOnly(BaseGridTable):
    def __init__(self,datas,colLblsValue):
        BaseGridTable.__init__(self,self.UpdateDatas(datas),self.UpdateColLblsValue(colLblsValue))

    def UpdateDatas(self,datas):
        if not datas or  not len(datas):
            return None
        for row in range(len(datas)):
            if type(datas[row]) == type([]):
                datas[row].insert(0,'')
            else:
                datas.insert(0,'')
                return datas
        return datas

    def UpdateColLblsValue(self,colLblsValue):
        if not colLblsValue or not len(colLblsValue):
            return None
        colLblsValue.insert(0,'')
        return colLblsValue

    def GetColLabelValue(self,col):
        return BaseGridTable.GetColLabelValue(self,col)

    '''
    'AppendRows(self,datas=None)
    '''
    def AppendRows(self,datas=None):
        datas = self.UpdateDatas(datas)
        if datas:
            BaseGridTable.AppendRows(self,datas)


    def UpdateTable(self,datas):
        datas = self.UpdateDatas(datas)
        if datas == self.datas:
            print u'数据是最新的'
            return
        BaseGridTable.UpdateTable(self,datas)